//点击投票按钮
function vote1(e){
//	var parent = document.getElementById("mynumber");
	var pNum = document.getElementById("mynumber");
	var num = parseInt(pNum.innerHTML.slice(3));
	num+=1;
	pNum.innerHTML =  "票数:"+ num;
	e.onclick = function(){}//不能第二次点击
	//初始化love
	e.innerHTML = '<span></span>';
	e.firstChild.style.opacity= 1;
	e.firstChild.style.width= "0px";
	e.firstChild.style.height= "0px";
	e.firstChild.style.top= "-10px";
	e.firstChild.style.right= "10px";
	var timer5,timer6,timer9;
	timer5 = setTimeout(function(){ //显示love
		showlove();
	},10)
	timer6 = setTimeout(function(){ //隐藏love
		hidelove();
	},1000)
	function showlove(){
		clearInterval(timer5);
		e.firstChild.style.right= "0px";
		e.firstChild.style.top= "-20px";
		e.firstChild.style.width= "20px";
		e.firstChild.style.height= "20px";
		success();
	}
	function hidelove(){
		clearInterval(timer6);
		e.firstChild.style.opacity= 0;
		//按钮背景
		e.style.background = "#969696";
		e.innerHTML = '已投票';
//		e.style.height = "24px";
		console.log(e.style.height)
	}
}
//投票成功提示文字
function success(){
	document.getElementById("success").style.display = "block";
	document.getElementById("success").style.opacity = 0;
	var hitimer,hitimer1;
	hitimer = setTimeout(function(){
		document.getElementById("success").style.opacity = 1;
	},10)
	hitimer = setTimeout(function(){
		document.getElementById("success").style.opacity = "0";
		nexhide();
		clearInterval(hitimer);
	},900)
}
function nexhide(){
	document.getElementById("success").style.display = "none";
}
//选中图片时显示
function showImg1(that){
	var imgFile = that.files[0];
    var fr = new FileReader();
    fr.onload = function() {
    	document.getElementById("ImgPr").src= fr.result;
    };
    fr.readAsDataURL(imgFile);
}
function showImg2(that){
	var imgFile2 = that.files[0];
    var fr2 = new FileReader();
    fr2.onload = function() {
    	document.getElementById("ImgPr2").src= fr2.result;
    };
    fr2.readAsDataURL(imgFile2);
}
function showImg3(that){
	var imgFile3 = that.files[0];
    var fr3 = new FileReader();
    fr3.onload = function() {
    	document.getElementById("ImgPr3").src= fr3.result;
    };
    fr3.readAsDataURL(imgFile3);
}

//标题背景移动
~(function(){
	var timer,len,len1,len2 = null;
	len = 100;
	timer = setInterval(function(){
		len -=1;
		len1 = (len)+"%";
		len2 = (100-len)*-1+"%";
		if(len<=0){
			len = 100;
		}else{
			document.getElementById("titlebg").style.left = len1;
			document.getElementById("titlebg2").style.left = len2;
		}
		
	},100)
	
})()
